package com.victor.dao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.victor.entity.Problem;

@Mapper
public interface ProblemDao {

	/**
	 * 获取问题列表（传类型）type 1.问答题,2.选择题,3.连线题,4.拼图题
	 * 
	 * @param type
	 * @return
	 */
	@Select({ "select * from problem where type=#{type} order by id desc" })
	List<Problem> getAllProblem(@Param("type") String type);

	/**
	 * 新建问题
	 * 
	 * @param problem
	 * @return
	 */
	@Insert({ "insert into problem (text_topic,audio_topic,type,problemphoto_url,answer_A,answer_B,answer_C,answer_D,answer_right,line_photo1,line_photo2,line_photo3,line_photo4,line_photo5,line_photo6,line_photo7,line_photo8) values (#{text_topic},#{audio_topic},#{type},#{problemphoto_url},#{answer_A},#{answer_B},#{answer_C},#{answer_D},#{answer_right},#{line_photo1},#{line_photo2},#{line_photo3},#{line_photo4},#{line_photo5},#{line_photo6},#{line_photo7},#{line_photo8})" })
	int createNewProblem(Problem problem);

	/**
	 * 批量删除问题
	 * 
	 * @param ids
	 * @return
	 */
	int batchDeleteProblem(@Param("ids") int[] ids);

	/**
	 * 修改问题信息
	 * 
	 * @param problem
	 * @return
	 */
	int updateProblem(Problem problem);

}
